package random

import (
	"math/rand"
	"strings"
	"time"
)

// GetRandomStr 生成指定长度的随机字符串
func GetRandomStr(count int) string {
	const randomList = "qwertyuiopasdfghjklzxcvbnm1234567890"
	const randomListLen = len(randomList)

	// 初始化随机数生成器
	rand.Seed(time.Now().UnixNano())

	var builder strings.Builder
	builder.Grow(count)

	for i := 0; i < count; i++ {
		index := rand.Intn(randomListLen)
		builder.WriteByte(randomList[index])
	}

	return builder.String()
}
